const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_ru_history_job', {
    id: {
      type: DataTypes.STRING(64),
      allowNull: false,
      primaryKey: true,
      field: 'ID_'
    },
    rev: {
      type: DataTypes.INTEGER,
      allowNull: true,
      field: 'REV_'
    },
    lockExpTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'LOCK_EXP_TIME_'
    },
    lockOwner: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'LOCK_OWNER_'
    },
    retries: {
      type: DataTypes.INTEGER,
      allowNull: true,
      field: 'RETRIES_'
    },
    exceptionStackId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      field: 'EXCEPTION_STACK_ID_'
    },
    exceptionMsg: {
      type: DataTypes.STRING(4000),
      allowNull: true,
      field: 'EXCEPTION_MSG_'
    },
    handlerType: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'HANDLER_TYPE_'
    },
    handlerCfg: {
      type: DataTypes.STRING(4000),
      allowNull: true,
      field: 'HANDLER_CFG_'
    },
    customValuesId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      field: 'CUSTOM_VALUES_ID_'
    },
    advHandlerCfgId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      field: 'ADV_HANDLER_CFG_ID_'
    },
    createTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'CREATE_TIME_'
    },
    scopeType: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'SCOPE_TYPE_'
    },
    tenantId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: "",
      field: 'TENANT_ID_'
    }
  }, {
    sequelize,
    tableName: 'act_ru_history_job',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_" },
        ]
      },
    ]
  });
};
